﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace c_Windows
{
    public partial class DisplayWeb : Form
    {
        public DisplayWeb()
        {
            InitializeComponent();
        }

        private void Starts_Click(object sender, EventArgs e)
        {
            try
            {
                if (checkBox1.Checked == true)
                    DisplayWebBrowser.Url = new Uri("https://www." + textBox1.Text.ToString() + ".com/", UriKind.Absolute);
                else
                    DisplayWebBrowser.Url = new Uri(textBox1.Text.ToString(), UriKind.Absolute);
            }
            catch (UriFormatException)
            {
                return;
            }
        }

        private void GoBacks_Click(object sender, EventArgs e)
        {
            DisplayWebBrowser.GoBack();
        }

        private void GoForwards_Click(object sender, EventArgs e)
        {
            DisplayWebBrowser.GoForward();
        }

        private void Refresh_Click(object sender, EventArgs e)
        {
            DisplayWebBrowser.Refresh();
        }

        private void baidu_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            DisplayWebBrowser.Url = new Uri("https://www.baidu.com/", UriKind.Absolute);
        }

        private void Google_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            DisplayWebBrowser.Url = new Uri("https://www.google.com.hk", UriKind.Absolute);
        }
    }
}
